package cn.huiyunche.base.service.interfaces.impl;

import cn.huiyunche.base.service.enums.COrderStatusEnum;
import cn.huiyunche.base.service.form.COrderTrackForm;
import cn.huiyunche.base.service.interfaces.SOrderForWebService;
import cn.huiyunche.base.service.interfaces.SOrderService;
import cn.huiyunche.base.service.vo.PageVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.Map;

@Service
public class SOrderForWebServiceImpl implements SOrderForWebService {

    @Autowired
    private SOrderService orderService;

    @Override
    public Map<String, Object> getSaveList(COrderTrackForm form, PageVo page) throws Exception {
        form.setStates(Arrays.asList(COrderStatusEnum.SAVED.getValue()));
        return orderService.getCwaybillsByConditions(form, page);
    }

    @Override
    public Map<String, Object> getWaitingReceiveList(COrderTrackForm form, PageVo page) throws Exception {
        form.setStates(Arrays.asList(COrderStatusEnum.WAIT_RECEIVE.getValue()));
        return orderService.getCwaybillsByConditions(form, page);
    }

    @Override
    public Map<String, Object> getBeingmplementedList(COrderTrackForm form, PageVo page) throws Exception {
        form.setStates(Arrays.asList(COrderStatusEnum.IN_TRANSIT.getValue()));
        return orderService.getCwaybillsByConditions(form, page);
    }

    @Override
    public Map<String, Object> getCompletedList(COrderTrackForm form, PageVo page) throws Exception {
        form.setStates(Arrays.asList(COrderStatusEnum.COMPLETED.getValue()));
        return orderService.getCwaybillsByConditions(form, page);
    }

    @Override
    public Map<String, Object> getDoneList(COrderTrackForm form, PageVo page) throws Exception {
        form.setStates(Arrays.asList(COrderStatusEnum.DONE.getValue()));
        return orderService.getCwaybillsByConditions(form, page);
    }

    @Override
    public Map<String, Object> getCancelList(COrderTrackForm form, PageVo page) throws Exception {
        form.setStates(Arrays.asList(COrderStatusEnum.CANCELED.getValue()));
        return orderService.getCwaybillsByConditions(form, page);
    }

    @Override
    public Map<String, Object> getAllList(COrderTrackForm form, PageVo page) throws Exception {
//		form.setStates(Arrays.asList(COrderStatusEnum.WAIT_RECEIVE.getValue()));
        return orderService.getCwaybillsByConditions(form, page);
    }
}
